#include <Arduino.h>

#include "Common.h"

#include <App_Sd.h>
#include <App_Wifi.h>
#include "App_I2S.h"
#include <App_Http.h>
#include "App_Screen.h"
#include <logo.h>

#include <APP_Rc522.h>
#include <BspOid.h>
#include <Sonix.h>



#define LED_PIN1 11
#define key0 0





void setup() {
  uart0_setup();

  Sd_setup();
  I2S_Init();
  I2S_RecoderInit();

  RC522_Init();
  
  TFT_SPI_INIT();
  TFT_init();
  App_WifiInit();

  // pinMode(LED_PIN1, OUTPUT);
  pinMode(key0, INPUT_PULLUP);  // 使用内部上拉
  // digitalWrite(LED_PIN1, HIGH);  


  

  Func_Oid_Init();


}


bool flag1 = false;
bool flag2 = true;


void loop() {

  if(flag1 == false) 
  {
    flag1 = true;
    Logo_display(normal_logo, WHITE,BLACK);
  }

  if (digitalRead(0) == LOW) {
      // App_Recorder();
      Logo_display(listen_logo, WHITE,BLACK);
      Audio_Record();
      printfme("Recording......\n");
      printfme("Record over!\n");
  }

  if(AuDio_len !=0) {
    http_test();
    AuDio_len = 0;
    printfme("Conversation over\n\n");
  }



RC522_test();
Sonix_ReceiveGeneralIndex();

}




